package edu.rakovic.elearning.service;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import edu.rakovic.elearning.interfaces.User;

public class UsersBean implements Users {
	
	private Map<String, User> users;

	public UsersBean(){
		this(new HashMap<String, User>());
	}
	
	public UsersBean(Map<String, User> users) {
		this.users = users;
	}
	
	public Collection<User> retreiveUsers() {
		return users.values();
	}

	public User save(User user) {
		return users.put(user.getUserName(), user);
	}

	public User retreiveSingleUser(String userName) {
		return users.get(userName);
	}

	public User delete(String userName) {
		return users.remove(userName);
	}

}
